package git.soulbgm.service.task;

import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;

/**
 * @author SoulBGM
 * @version 1.0
 * @date 2019/7/8 16:38
 */
public class TaskMap {

    private static Map<Long, ScheduledFuture> map = new ConcurrentHashMap<>();

    public static void add(Long taskId, ScheduledFuture future) {
        map.put(taskId, future);
    }

    public static ScheduledFuture get(Long taskId) {
        return map.get(taskId);
    }

    public static boolean containsTask(Long taskId) {
        return map.containsKey(taskId);
    }

    public static void remove(Long taskId) {
        map.remove(taskId);
    }

    public static Map<Long, ScheduledFuture> getMap() {
        return map;
    }

    public static Set<Long> keySet() {
        return map.keySet();
    }

}
